#include <bits/stdc++.h>

using namespace std;

class UnionFind {
    private:
        vector<int> parent, rankv;
    public:
        UnionFind(int n) : parent(n), rankv(n, 0){
            for(int i = 0; i < n; i++){
                parent[i] = i;
            }
        }
        int findp(int x){
            if(parent[x] != x) parent[x] = findp(parent[x]);
            return parent[x];
        }
        void uni(int x, int y){
            x = findp(x); 
            y = findp(y);
            if(x == y) return;
            if(rankv[x] < rankv[y]) swap(x, y);
            parent[y] = x;
            if(rankv[x] == rankv[y]) rankv[x]++;
        }
    };

int main() {
    
    //system("pause");
    return 0;
}
